package com.vipsoft.locker.controller;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vipsoft.base.core.ApiResult;
import com.vipsoft.base.core.BaseController;
import com.vipsoft.base.entity.locker.CategoryInfo;
import com.vipsoft.base.entity.wechat.MemberInfo;
import com.vipsoft.locker.service.ICategoryService;
import com.vipsoft.locker.service.IMemberService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * 用户管理
 */
@RestController
@RequestMapping("/member")
public class MemberController extends BaseController {

    Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    IMemberService memberService;


    @PostMapping("/save")
    public ApiResult save(HttpServletRequest request, @RequestBody MemberInfo param) {
        if (param == null) {
            return new ApiResult(6001, "传入参数无效");
        }
        if (StrUtil.isEmpty(param.getId())) {
            return new ApiResult(6001, "必须传入用户编号");
        }
        boolean result = memberService.save(param);
        return new ApiResult(result);
    }
}
